package io;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

public class RGMatrixFileFormat {

	private static void writeMATFile(List<GPSPoint> points, File outFile) throws IOException {
		BufferedWriter w = new BufferedWriter(new FileWriter(outFile));
		//Name	chr	pos	Exp1	Exp2
		w.write("Name\tchr\tpos\tElevation\tSpeed\tPrecission\n");
		int c = 0;
		long start = 0;
		for (GPSPoint gpsPoint : points) {
			if (c == 0) {
				start = points.get(0).getTime();
			}
			w.write("Egal\tchr1");
			w.write("\t" + (gpsPoint.getTime() - start));
			w.write("\t" + gpsPoint.getEvelation());
			w.write("\t" + gpsPoint.getSpeed());
			w.write("\t" + gpsPoint.getPrecission());
			w.write("\n");
			c++;
		}
		w.close();
	}

	public static void main(String[] args) throws Exception {
		List<GPSPoint> points = SimpleParser.parseFile(new File("C:/Users/oliver/Documents/My Dropbox/runs/06_10_2011 12o11o15.gps"));
		File outFile = new File("c:/temp/data.mat");
		writeMATFile(points, outFile);
	}

}
